<?php
	/**
	 * 消息列表
	 */
    class MessageList extends APIBase {
		
		public $tag = "MessageList";
		
		public function before() {
			$this->initMysql();
			return true;
		}
		
		public function logic() {
			$row = $this->mysql->select("message", "*", array('uid' => $this->uid), "ORDER BY create_time DESC LIMIT 0, 30");
			$messages = array();
			foreach ($row as $ro) {
				$message = array();
				$message['mid'] = (int) $ro['id'];
				$message['status'] = (int) $ro['status'];
				$message['date'] = (int) $ro['create_time'];
				$message['title'] = $ro['title'];
				$message['content'] = $ro['content'];
				$messages[] = $message;
			}
			$this->returnData(array('messages' => $messages));
		}
		
		public function after() {
			$this->deinitMysql();
		}
    }
?>